import request from '@/utils/request'

// 登录接口
export const login = data => {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

// 获取短信验证码（登录）
export const loginCode = mobile => {
  return request({
    url: '/login/code',
    method: 'get',
    params: {
      mobile: mobile
    }
  })
}

// 短信验证码登录
export const loginCodePost = data => {
  return request({
    url: '/login/code',
    method: 'post',
    data
  })
}

// 获取验证码
export const registerCode = mobile => {
  return request({
    url: '/register/code',
    method: 'get',
    params: {
      mobile: mobile
    }
  })
}

// 注册接口
export const register = data => {
  return request({
    url: '/register',
    method: 'post',
    data
  })
}

// 三方登录
export const loginSocial = openId => {
  return request({
    url: '/login/social',
    method: 'post',
    data: {
      unionId: openId,
      source: 6
    }
  })
}

// 三方登录-完善信息
export const loginSocialComplement = (unionId, data) => {
  return request({
    url: `/login/social/${unionId}/complement`,
    method: 'post',
    data
  })
}
